package cn.dansj.repository;

import cn.dansj.entity.ArticleTag;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ArticleTagRepository extends JpaRepository<ArticleTag, String>, JpaSpecificationExecutor<ArticleTag> {
    void deleteAllByBlogSequence(String blogSequence);

    @Query("select t.tag,count(t) from ArticleTag t group by t.tag order by 2 desc,1")
    List<Object[]> tagCount();
}
